<?php
/**
* @version $Id: search.html.php 10002 2008-02-08 10:56:57Z willebil $
* @package Joomla
* @subpackage Search
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

// no direct access
defined( '_VALID_MOS' ) or die( 'Restricted access' );

/**
* @package Joomla
* @subpackage Search
*/
class search_html {
	function displaySearch( &$total, &$rows, &$pageNav, &$link_page, &$numberPage, &$searchword ){
	global $mosConfig_live_site;
	$url = $mosConfig_live_site."/administrator/components/com_content/uploads/";
	?>
	<div id="title-cat"><div>Kết quả tìm kiếm</div></div>
    <div id="content-cat">
		<table border="0" width="100%">
 		 	<tbody>
 		 	<tr>
 		 	<?php
			for ($i=0; $i<count($rows); $i++){
			$link = sefRelToAbs("index.php?option=com_content&task=view&catid=".$rows[$i]->catid."&id=".$rows[$i]->id).$rows[$i]->title_alias.".html";
			if (($i+1)%2==0){
				$style = ' class="tdhome"';
			}else{
				$style = ' class="tdhome1"';
			}
			?>
			    <td<?php echo $style;?> style="padding: 10px; position: relative;" align="left" valign="top" width="50%">
				    <div style="position:relative; height:130px;">
					    <div class="servicehomename" style="padding-bottom:10px; text-align:left">
					    <a href="<?php echo $link;?>"><?php echo $rows[$i]->title;?></a>
					    </div>
				      	<a href="<?php echo $link;?>"><img style="margin-right: 5px;" src="<?php echo $url.$rows[$i]->img;?>" class="newsimage" align="left" border="0"></a>
				      	<?php if($rows[$i]->sectionid==1){?>
				      	<div class="contexthome" align="justify">
				      		<?php
				      		if ($rows[$i]->price_niem_yet>0){
								echo 'Giá niêm yết: '.number_format($rows[$i]->price_niem_yet,0,',','.').' VNĐ';
				      			if($rows[$i]->don_vi!=''){
									echo ' /<b> '.$rows[$i]->don_vi.'</b><br />';
								}
							}
							if ($rows[$i]->price_giam>0){
								echo 'Giá bán: <b style="color:red;">'.number_format($rows[$i]->price,0,',','.').' VNĐ</b>';
								if($rows[$i]->don_vi!=''){
									echo ' /<b> '.$rows[$i]->don_vi.'</b><br />';
								}
							}else{
								echo 'Giá bán: <b style="color:red;">'.number_format($rows[$i]->price,0,',','.').' VNĐ</b>';
								if($rows[$i]->don_vi!=''){
									echo ' /<b> '.$rows[$i]->don_vi.'</b><br />';
								}
							}
							?>
				      	</div>
				      	<?php }else{?>
				      	<div class="contexthome" align="justify"><?php echo mb_substr($rows[$i]->introtext,0,200,"utf-8")."...";?></div>
				      	<?php }?>
					    <div style="padding-top:3px; width:120px; right:0px; position:absolute; top:110px; " align="left">
					    	<a href="<?php echo $link;?>"><img src="<?php echo $mosConfig_live_site;?>/templates/dogolangchang/images/viewdetail.jpg" style="margin-left: 30px;" border="0" width="76" height="12"></a>
					    </div>
				    </div>
				</td>
			<?php
			if (($i+1)%2==0){
				echo '</tr>';
				echo '<tr>';
			} 
			}
			?>	   
			</tbody>
		</table>
		<?php
		if($total>$numberPage){
			?>
			<div class="page">
			<?php
			echo $pageNav->writePagesLinks( $link_page );
			?>
			</div>
			<?php
		}
		?>
	</div>
	<?php
	}
}
?>